<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>多格式文件下载中心</title>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        :root {
            --primary-color: #4285f4;
            --secondary-color: #34a853;
            --accent-color: #ea4335;
            --light-gray: #f5f5f5;
            --dark-gray: #333;
            --medium-gray: #757575;
            --file-apk: #34a853;
            --file-zip: #fbbc05;
            --file-image: #ea4335;
            --file-doc: #4285f4;
            --file-pdf: #db4437;
            --file-audio: #9c27b0;
            --file-video: #ff5722;
            --file-other: #9e9e9e;
        }
        
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'Roboto', 'PingFang SC', 'Microsoft YaHei', sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, #f8f9fa, #eef2f6);
            color: #333;
            line-height: 1.6;
            min-height: 100vh;
            padding: 20px;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }
        
        .header {
            text-align: center;
            margin-bottom: 30px;
            padding: 20px;
            background: white;
            border-radius: 15px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        }
        
        .header h1 {
            color: var(--primary-color);
            font-size: 2.8rem;
            margin-bottom: 10px;
            background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
        
        .header p {
            color: var(--medium-gray);
            font-size: 1.2rem;
            max-width: 700px;
            margin: 0 auto;
        }
        
        .features {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 20px;
            margin-bottom: 30px;
        }
        
        .feature-badge {
            background: white;
            border-radius: 50px;
            padding: 10px 20px;
            display: flex;
            align-items: center;
            box-shadow: 0 3px 10px rgba(0,0,0,0.08);
        }
        
        .feature-badge i {
            margin-right: 8px;
            color: var(--primary-color);
        }
        
        .search-container {
            display: flex;
            justify-content: center;
            margin-bottom: 30px;
            position: relative;
        }
        
        .search-box {
            display: flex;
            width: 100%;
            max-width: 700px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            border-radius: 30px;
            overflow: hidden;
            transition: all 0.3s ease;
            background: white;
        }
        
        .search-box:hover {
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
        }
        
        .search-input {
            flex: 1;
            padding: 17px 25px;
            border: none;
            font-size: 17px;
            outline: none;
            background: transparent;
        }
        
        .search-button {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 0 35px;
            cursor: pointer;
            transition: background-color 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            font-weight: 500;
        }
        
        .search-button:hover {
            background-color: #3367d6;
        }
        
        .search-button i {
            margin-right: 10px;
        }
        
        .card {
            background-color: white;
            border-radius: 15px;
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
            overflow: hidden;
            margin-bottom: 30px;
            transition: transform 0.3s, box-shadow 0.3s;
        }
        
        .card:hover {
            transform: translateY(-7px);
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
        }
        
        .card-header {
            background: linear-gradient(90deg, var(--primary-color), #5b8def);
            color: white;
            padding: 18px 25px;
            font-size: 1.3rem;
            font-weight: 500;
            display: flex;
            align-items: center;
        }
        
        .card-header i {
            margin-right: 12px;
            font-size: 1.4rem;
        }
        
        .table {
            width: 100%;
            border-collapse: collapse;
        }
        
        .table th {
            background-color: #f8f9fa;
            color: var(--dark-gray);
            padding: 18px;
            text-align: left;
            font-weight: 500;
            font-size: 16px;
            border-bottom: 2px solid #eee;
        }
        
        .table td {
            padding: 18px;
            border-bottom: 1px solid #f0f0f0;
            vertical-align: middle;
        }
        
        .table tr:last-child td {
            border-bottom: none;
        }
        
        .table tr:hover {
            background-color: #fafbff;
        }
        
        .file-icon {
            width: 50px;
            height: 50px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
            color: white;
        }
        
        .file-icon.apk { background-color: var(--file-apk); }
        .file-icon.zip { background-color: var(--file-zip); }
        .file-icon.image { background-color: var(--file-image); }
        .file-icon.doc { background-color: var(--file-doc); }
        .file-icon.pdf { background-color: var(--file-pdf); }
        .file-icon.audio { background-color: var(--file-audio); }
        .file-icon.video { background-color: var(--file-video); }
        .file-icon.other { background-color: var(--file-other); }
        
        .file-name {
            display: flex;
            align-items: center;
            font-weight: 500;
            font-size: 17px;
        }
        
        .file-type {
            display: inline-block;
            padding: 4px 10px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 500;
            margin-left: 12px;
            background: #f0f4ff;
            color: var(--primary-color);
        }
        
        .download-btn {
            background: linear-gradient(135deg, var(--secondary-color), #2d9249);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
            font-size: 15px;
            font-weight: 500;
            box-shadow: 0 3px 8px rgba(52, 168, 83, 0.3);
        }
        
        .download-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(52, 168, 83, 0.4);
        }
        
        .download-btn i {
            margin-right: 8px;
        }
        
        .file-size {
            color: var(--medium-gray);
            font-size: 15px;
            font-weight: 500;
        }
        
        .no-results {
            text-align: center;
            padding: 50px;
            color: var(--medium-gray);
            font-size: 18px;
        }
        
        .footer {
            text-align: center;
            padding: 25px;
            color: var(--medium-gray);
            font-size: 14px;
            margin-top: 20px;
        }
        
        .filter-bar {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 12px;
            margin-bottom: 25px;
        }
        
        .filter-btn {
            padding: 10px 20px;
            border-radius: 30px;
            background: white;
            border: 2px solid #e0e0e0;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
        }
        
        .filter-btn i {
            margin-right: 8px;
        }
        
        .filter-btn.active, .filter-btn:hover {
            background: var(--primary-color);
            color: white;
            border-color: var(--primary-color);
            box-shadow: 0 4px 10px rgba(66, 133, 244, 0.3);
        }
        
        @media (max-width: 768px) {
            .header h1 {
                font-size: 2.2rem;
            }
            
            .search-box {
                flex-direction: column;
                border-radius: 15px;
            }
            
            .search-input {
                padding: 15px;
            }
            
            .search-button {
                padding: 15px;
                justify-content: center;
            }
            
            .table th, .table td {
                padding: 14px;
            }
            
            .file-icon {
                width: 40px;
                height: 40px;
                font-size: 18px;
            }
            
            .file-name {
                font-size: 16px;
            }
            
            .filter-bar {
                gap: 8px;
            }
            
            .filter-btn {
                padding: 8px 15px;
                font-size: 14px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>多格式文件下载中心</h1>
            <p>安全、高效的文件下载服务，支持APK、图片、压缩包、文档等多种格式文件</p>
            
            <div class="features">
                <div class="feature-badge">
                    <i class="fas fa-shield-alt"></i> 安全下载
                </div>
                <div class="feature-badge">
                    <i class="fas fa-bolt"></i> 高速传输
                </div>
                <div class="feature-badge">
                    <i class="fas fa-file-alt"></i> 多种格式支持
                </div>
                <div class="feature-badge">
                    <i class="fas fa-cloud-download-alt"></i> 无需注册
                </div>
            </div>
        </div>
        
        <div class="filter-bar">
            <button class="filter-btn active" data-filter="all">
                <i class="fas fa-layer-group"></i> 全部文件
            </button>
            <button class="filter-btn" data-filter="apk">
                <i class="fab fa-android"></i> APK文件
            </button>
            <button class="filter-btn" data-filter="image">
                <i class="fas fa-image"></i> 图片文件
            </button>
            <button class="filter-btn" data-filter="zip">
                <i class="fas fa-file-archive"></i> 压缩文件
            </button>
            <button class="filter-btn" data-filter="doc">
                <i class="fas fa-file-word"></i> 文档文件
            </button>
        </div>
        
        <div class="search-container">
            <div class="search-box">
                <input type="text" class="search-input" id="searchInput" placeholder="搜索文件名称、类型或大小..." autocomplete="off">
                <button class="search-button" onclick="loadJSONData()">
                    <i class="fas fa-search"></i> 搜索文件
                </button>
            </div>
        </div>
        
        <div class="card">
            <div class="card-header">
                <i class="fas fa-download"></i> 可用文件列表
            </div>
            <div class="table-responsive">
                <table id="myTable" class="table">
                    <thead>
                        <tr>
                            <th style="width: 70px;"></th>
                            <th>文件名称</th>
                            <th style="width: 120px;">大小</th>
                            <th style="width: 120px;">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <!-- 数据将通过JavaScript动态加载 -->
                    </tbody>
                </table>
            </div>
        </div>
        
        <div class="footer">
            <p>© 2023 多格式文件下载中心 | 安全可靠的文件下载服务</p>
        </div>
    </div>

    <script>
        // 模拟数据 - 实际应用中应通过AJAX获取
        const mockData = {
            "data": [
                {
                    "Name": "微信安卓版",
                    "Size": "256 MB",
                    "DownloadUrl": "#",
                    "Type": "apk",
                    "Icon": "fab fa-android"
                },
                {
                    "Name": "产品宣传册",
                    "Size": "15.2 MB",
                    "DownloadUrl": "#",
                    "Type": "pdf",
                    "Icon": "fas fa-file-pdf"
                },
                {
                    "Name": "项目文档",
                    "Size": "8.7 MB",
                    "DownloadUrl": "#",
                    "Type": "doc",
                    "Icon": "fas fa-file-word"
                },
                {
                    "Name": "自然风景壁纸",
                    "Size": "4.3 MB",
                    "DownloadUrl": "#",
                    "Type": "image",
                    "Icon": "fas fa-image"
                },
                {
                    "Name": "系统工具包",
                    "Size": "102.4 MB",
                    "DownloadUrl": "#",
                    "Type": "zip",
                    "Icon": "fas fa-file-archive"
                },
                {
                    "Name": "背景音乐合集",
                    "Size": "45.6 MB",
                    "DownloadUrl": "#",
                    "Type": "audio",
                    "Icon": "fas fa-file-audio"
                },
                {
                    "Name": "产品演示视频",
                    "Size": "78.9 MB",
                    "DownloadUrl": "#",
                    "Type": "video",
                    "Icon": "fas fa-file-video"
                },
                {
                    "Name": "数据备份文件",
                    "Size": "32.1 MB",
                    "DownloadUrl": "#",
                    "Type": "other",
                    "Icon": "fas fa-file"
                },
                {
                    "Name": "支付宝最新版",
                    "Size": "98.7 MB",
                    "DownloadUrl": "#",
                    "Type": "apk",
                    "Icon": "fab fa-android"
                },
                {
                    "Name": "团队照片集",
                    "Size": "21.3 MB",
                    "DownloadUrl": "#",
                    "Type": "image",
                    "Icon": "fas fa-images"
                },
                {
                    "Name": "项目源码包",
                    "Size": "56.8 MB",
                    "DownloadUrl": "#",
                    "Type": "zip",
                    "Icon": "fas fa-file-archive"
                },
                {
                    "Name": "年度报告",
                    "Size": "7.2 MB",
                    "DownloadUrl": "#",
                    "Type": "pdf",
                    "Icon": "fas fa-file-pdf"
                }
            ]
        };

        window.onload = function() {
            loadJSONData();
            
            // 添加回车键搜索功能
            document.getElementById("searchInput").addEventListener("keypress", function(event) {
                if (event.key === "Enter") {
                    loadJSONData();
                }
            });
            
            // 添加过滤功能
            document.querySelectorAll('.filter-btn').forEach(button => {
                button.addEventListener('click', function() {
                    // 移除其他按钮的active类
                    document.querySelectorAll('.filter-btn').forEach(btn => {
                        btn.classList.remove('active');
                    });
                    
                    // 添加active类到当前按钮
                    this.classList.add('active');
                    
                    // 重新加载数据
                    loadJSONData();
                });
            });
        };

        function loadJSONData() {
            var tableBody = document.querySelector("#myTable tbody");
            tableBody.innerHTML = ""; // 清空表格内容
            
            var loadingRow = document.createElement("tr");
            var loadingCell = document.createElement("td");
            loadingCell.colSpan = 4;
            loadingCell.style.textAlign = "center";
            loadingCell.style.padding = "40px";
            loadingCell.innerHTML = '<div style="font-size: 24px; color: #4285f4;"><i class="fas fa-spinner fa-spin"></i> 加载文件中...</div>';
            loadingRow.appendChild(loadingCell);
            tableBody.appendChild(loadingRow);
            
            // 模拟AJAX延迟
            setTimeout(function() {
                try {
                    var data = mockData;
                    var searchValue = document.getElementById("searchInput").value.trim().toLowerCase();
                    
                    // 获取当前选中的过滤器
                    const activeFilter = document.querySelector('.filter-btn.active').dataset.filter;
                    
                    tableBody.innerHTML = ""; // 清除加载提示
                    
                    if (!data.data || data.data.length === 0) {
                        var noDataRow = document.createElement("tr");
                        var noDataCell = document.createElement("td");
                        noDataCell.colSpan = 4;
                        noDataCell.style.textAlign = "center";
                        noDataCell.style.padding = "40px";
                        noDataCell.innerHTML = '<div style="font-size: 18px; color: #ea4335;"><i class="far fa-folder-open"></i> 没有找到文件</div>';
                        noDataRow.appendChild(noDataCell);
                        tableBody.appendChild(noDataRow);
                        return;
                    }
                    
                    var filteredData = data.data.filter(function(item) {
                        // 应用过滤器
                        if (activeFilter !== 'all' && item.Type !== activeFilter) {
                            return false;
                        }
                        
                        // 应用搜索
                        return searchValue === '' || 
                               item.Name.toLowerCase().includes(searchValue) || 
                               (item.Size && item.Size.toLowerCase().includes(searchValue)) || 
                               (item.Type && item.Type.toLowerCase().includes(searchValue));
                    });
                    
                    if (filteredData.length === 0) {
                        var noResultsRow = document.createElement("tr");
                        var noResultsCell = document.createElement("td");
                        noResultsCell.colSpan = 4;
                        noResultsCell.style.textAlign = "center";
                        noResultsCell.style.padding = "40px";
                        noResultsCell.innerHTML = '<div style="font-size: 18px;"><i class="fas fa-search"></i> 没有找到匹配的文件</div>';
                        noResultsRow.appendChild(noResultsCell);
                        tableBody.appendChild(noResultsRow);
                        return;
                    }
                    
                    filteredData.forEach(function(item) {
                        var row = document.createElement("tr");
                        
                        // 文件图标列
                        var iconCell = document.createElement("td");
                        var iconDiv = document.createElement("div");
                        iconDiv.className = `file-icon ${item.Type}`;
                        
                        var iconEl = document.createElement("i");
                        iconEl.className = item.Icon;
                        iconDiv.appendChild(iconEl);
                        
                        iconCell.appendChild(iconDiv);
                        row.appendChild(iconCell);
                        
                        // 文件名称列
                        var nameCell = document.createElement("td");
                        nameCell.className = "file-name";
                        nameCell.innerHTML = `<span>${item.Name}</span><span class="file-type">${item.Type.toUpperCase()}</span>`;
                        row.appendChild(nameCell);
                        
                        // 大小列
                        var sizeCell = document.createElement("td");
                        sizeCell.className = "file-size";
                        sizeCell.textContent = item.Size || "未知";
                        row.appendChild(sizeCell);
                        
                        // 下载列
                        var downloadCell = document.createElement("td");
                        if (item.DownloadUrl) {
                            var downloadBtn = document.createElement("a");
                            downloadBtn.href = item.DownloadUrl;
                            downloadBtn.className = "download-btn";
                            downloadBtn.innerHTML = '<i class="fas fa-download"></i> 下载';
                            downloadBtn.onclick = function(e) {
                                e.preventDefault();
                                simulateDownload(item.Name);
                            };
                            downloadCell.appendChild(downloadBtn);
                        } else {
                            downloadCell.innerHTML = '<span style="color: #ea4335;">不可用</span>';
                        }
                        row.appendChild(downloadCell);
                        
                        tableBody.appendChild(row);
                    });
                } catch (e) {
                    console.error("解析数据出错:", e);
                    tableBody.innerHTML = "";
                    var errorRow = document.createElement("tr");
                    var errorCell = document.createElement("td");
                    errorCell.colSpan = 4;
                    errorCell.style.textAlign = "center";
                    errorCardell.style.padding = "40px";
                    errorCell.style.color = "var(--accent-color)";
                    errorCell.innerHTML = '<div style="font-size: 18px;"><i class="fas fa-exclamation-triangle"></i> 加载数据出错</div>';
                    errorRow.appendChild(errorCell);
                    tableBody.appendChild(errorRow);
                }
            }, 800); // 模拟网络延迟
        }
        
        function simulateDownload(fileName) {
            // 模拟下载效果
            const btn = event.target.closest('.download-btn');
            const originalText = btn.innerHTML;
            
            btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 下载中...';
            btn.style.opacity = '0.8';
            
            setTimeout(() => {
                btn.innerHTML = '<i class="fas fa-check"></i> 下载完成';
                btn.style.background = 'linear-gradient(135deg, #34a853, #2d9249)';
                
                // 显示下载提示
                showDownloadToast(fileName);
                
                setTimeout(() => {
                    btn.innerHTML = originalText;
                    btn.style.opacity = '1';
                    btn.style.background = 'linear-gradient(135deg, var(--secondary-color), #2d9249)';
                }, 2000);
            }, 1500);
        }
        
        function showDownloadToast(fileName) {
            // 创建toast元素
            const toast = document.createElement('div');
            toast.style.position = 'fixed';
            toast.style.bottom = '20px';
            toast.style.right = '20px';
            toast.style.backgroundColor = '#34a853';
            toast.style.color = 'white';
            toast.style.padding = '15px 25px';
            toast.style.borderRadius = '8px';
            toast.style.boxShadow = '0 5px 15px rgba(0,0,0,0.2)';
            toast.style.zIndex = '1000';
            toast.style.display = 'flex';
            toast.style.alignItems = 'center';
            toast.style.transform = 'translateY(100px)';
            toast.style.opacity = '0';
            toast.style.transition = 'all 0.3s ease';
            
            toast.innerHTML = `
                <i class="fas fa-check-circle" style="font-size: 24px; margin-right: 15px;"></i>
                <div>
                    <div style="font-weight: 500; font-size: 16px;">下载成功！</div>
                    <div style="font-size: 14px; opacity: 0.9;">${fileName} 已开始下载</div>
                </div>
            `;
            
            document.body.appendChild(toast);
            
            // 显示toast
            setTimeout(() => {
                toast.style.transform = 'translateY(0)';
                toast.style.opacity = '1';
            }, 100);
            
            // 3秒后移除toast
            setTimeout(() => {
                toast.style.transform = 'translateY(100px)';
                toast.style.opacity = '0';
                
                setTimeout(() => {
                    document.body.removeChild(toast);
                }, 300);
            }, 3000);
        }
    </script>
</body>
</html>